<template>
	<cl-select-table
		v-model="value"
		:title="t('选择品牌信息')"
		:service="service.product.brand"
		:columns="columns"
		:multiple="multiple"
		:dict="{ text: 'name' }"
		pickerType="text"
	/>
</template>

<script setup lang="ts">
defineOptions({
	name: "product-brand-select",
});

import { useCool } from "/@/cool";
import { useI18n } from "vue-i18n";
import { CrudProps } from "/#/crud";
import { ref, useModel } from "vue";

const props = defineProps({
	...CrudProps,
	modelValue: null,
	multiple: Boolean,
});

const { service } = useCool();
const { t } = useI18n();

const value = useModel(props, "modelValue");

const columns = ref([
	{ label: t("名称"), prop: "name", minWidth: 140 },
	{
		label: t("Logo"),
		prop: "logo",
		minWidth: 100,
		component: { name: "cl-image", props: { size: 60 } },
	},
	{
		label: t("品牌描述"),
		prop: "description",
		showOverflowTooltip: true,
		minWidth: 200,
	},
	{
		label: t("成立年份"),
		prop: "foundingYear",
		minWidth: 140,
		sortable: "custom",
	},
]);
</script>
